package com.ding.custommanagersys.entity;

/**
 * 返回结果封装类
 * @author wang
 * @createTime 2022-11-26 19:33
 */
public class ResultData<T> {

    private int code;
    private String msg;
    private long count;
    private T data;

    public ResultData() {
    }

    public ResultData(int code, String msg, int count, T data) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    public ResultData<T> ok(){
        this.code = 0;
        this.msg = "ok";
        return this;
    }

    public ResultData<T> error(String msg){
        this.code = -1;
        this.msg = msg;
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public long getCount() {
        return count;
    }

    public void setCount(long count) {
        this.count = count;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
